import React, { Component } from 'react'

export default class RefCom extends Component {
  //声明事件会回调
  send = () => {
    //获取input的输入内容
    let v = this.input.value;
    //设置
    this.div.innerHTML = v;
  }

  render() {
    return (
      <div>
        <input ref={el => {
          this.input = el;
        }} type="text" /><button onClick={this.send}>发送</button>
        <hr />
        <div ref={el => this.div = el} style={{
          width: 400,
          height: 300,
          border: 'solid 1px #234'
        }}></div>
      </div>
    )
  }
}
